/* ****************************************************************
   ****************************************************************
   * Com++ Professional (c) 2009 C++ World
   * http://www.cplusplusworld.com/ mailto:compp@cplusplusworld.com
   ****************************************************************
   ****************************************************************
*/

#ifndef  SSRV_H
#define  SSRV_H

#include "ComPlusPlus/SocketTcp.h"
#include "ComPlusPlus/Thread.h"
#include "ComPlusPlus/SSrvContext.h"
#include "ComPlusPlus/SSrvProperties.h"

namespace compp {
class SSrv : public compp::Thread {

 public:
  SSrv( );
  SSrv( const SSrvProperties & prop);
  SSrv( const std::string & IPAddr, const int port, const SSrvProperties & prop);
  SSrv( const int port );
  SSrv( const std::string & IPAddr, const int port );
  virtual~SSrv( );

  void commenceWork ();
  void setPort ( const int p ) { port = p ;}
  void setIPAddr ( const std::string & s ) { IPAddr = s ; }
  void SetProperties( const SSrvProperties & prop);
  virtual std::string  executeTransaction (  const std::string & request, SSrvContext & Context );
  
  void *Run (void*v);

  
 protected:

  std::string IPAddr;
  int port;
  compp::SocketTcp Server ;

  SSrvProperties ServerProperties;

};
}

#endif
